package com.gzucm.Scholarship.common.enums;

import java.util.Objects;

public enum SystemState {
    OPEN_UP("开放填报"),//学生可填报
    EXAMINE("评定审核"),//学生填报结束，审核
    REPORT("结果公布"),//结果公布阶段
    SUSPEND("系统关闭");//评定结束

    private String detail;

    private SystemState(String detail) {
        this.detail = detail;
    }

    public String getDetail() {
        return detail;
    }

    public static SystemState get(String name) {
        for (SystemState s : SystemState.values()) {
            if (Objects.equals(s.name(), name)) {
                return s;
            }
        }
        return null;
    }

    /**
     * 按优先级获取，用于MultiThreadScheduleTask
     *
     * @param code
     * @return
     */
    public static SystemState get(Integer code) {
        switch (code) {
            case 1:
                return SUSPEND;
            case 2:
                return REPORT;
            case 3:
                return EXAMINE;
            case 4:
                return OPEN_UP;
        }
        return null;
    }
}
